{extend name='public/window' /}

{block name="content"}
<style>
    .layui-upload-drag {
        position: relative;
        padding: 10px;
        border: 1px dashed #e2e2e2;
        background-color: #fff;
        text-align: center;
        cursor: pointer;
        color: #999;
        border-radius: 50%;
    }

    .layui-input-block {
        margin-left: 170px !important;
    }

    .layui-form-label {
        width: 130px !important;
    }

    .layui-input, .layui-textarea {
        display: inline-block;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
                {if isset($info.id)}
                <input type="hidden" name="id" value="{$info.id}">
                {/if}
                <input type="hidden" name="__token__" id="token" value="{:token()}"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">组别名称 *</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" autocomplete="off"
                               placeholder="请输入组别名称" class="layui-input" id="name">
                    </div>
                </div>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">请选择商户</label>
                        <div class="layui-input-block">
                            <div id="task_id" style="width:80%"></div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button class="layui-btn" lay-submit="" lay-filter="add">{:__('Submit')}</button>
                            <button type="reset" class="layui-btn layui-btn-primary">{:__('Reset')}</button>
                        </div>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
<style>
    xm-select{
        height: 56px!important;
        line-height: 56px!important;
    }
</style>

<script>
    layui.use(['element', 'form', 'jquery', 'lucky', 'upload', 'laydate', 'xmSelect'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var lucky = layui.lucky;
        //表单赋值
        var info = {:json_encode($info)};
        var task = {:json_encode($task)};
        var demo5 = xmSelect.render({
            el:'#task_id',
            toolbar: { // 工具条【‘全选’，‘清空’】
                show: true, // 开启工具条
                showIcon: false, // 隐藏工具条的图标
            },
            data:task,
            filterable: true, // 开启搜索模式，默认按照name进行搜索
        })
        form.val("form", info);
        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('add')}", data.field, true);
            return false;
        });
    })
</script>

{/block}

